package com.zcq.dm.masking;

import com.zcq.dm.enums.DMTypeEnum;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 *  具体实现是否脱敏的服务
 */
@Service
public class DataMasking implements IDataMasking {

    @Override
    public boolean isHitWhite(DMTypeEnum typeEnum) {
//        UserInfoDto userInfo = AuthenticationUtils.getUserInfo();
//        if(userInfo == null || CollectionUtils.isEmpty(userInfo.getDataMaskingWhiteList())){
//            return false;
//        }
//        return userInfo.getDataMaskingWhiteList().contains(typeEnum.getCode());

//        TODO 具体脱敏逻辑 ，可以根据用户权限，是否有查看当前字段脱敏权限   命中则不脱敏
        List<Integer> dataMaskingWhiteList = new ArrayList<>();
        dataMaskingWhiteList.add(70);
        return dataMaskingWhiteList.contains(typeEnum.getCode());
    }
}
